﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using Ue.Framework.Data;
using Ue.Infrastructure.EntityFactoryFramework;
using Ue.Qcdz.Domain.TheResource;

namespace Ue.Qcdz.Repositories.TheResource
{
    internal class ResourceFactory : IEntityFactory<Resource>
    {
        internal class FieldNames : FieldNamesBase
        {
            public const string Name = "Name";
            public const string Num = "Num";
        }
        #region Implementation of IEntityFactory<Resource>

        public Resource BuildEntity(IDataReader reader)
        {
            return new Resource(
                reader.Get<string>(FieldNames.Name),
                reader.Get<int>(FieldNames.Num),
                reader.Get<Guid>(FieldNames.EntityKey)
                );
        }

        #endregion
    }
}
